<?php
class AdTable extends Doctrine_Table
{
    
  public static function getInstance()
  {
    return Doctrine_Core::getTable('Ad');
  }
  public function getAdByAdtype($adtype,$max)
  {
    $q = Doctrine_Query::create()
      ->from('Ad k')
      ->where('k.adtype_id =?',$adtype)
      ->orderBy('id desc')
      ->limit($max);
    return $q->execute();
  }

}